\(\int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx\) [439]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 62 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=b \left (3 a^2-b^2\right ) x-\frac {3 a b^2 \log (\cos (c+d x))}{d}+\frac {a^3 \log (\sin (c+d x))}{d}+\frac {b^2 (a+b \tan (c+d x))}{d} \]

[Out]

b*(3*a^2-b^2)*x-3*a*b^2*ln(cos(d*x+c))/d+a^3*ln(sin(d*x+c))/d+b^2*(a+b*tan(d*x+c))/d

Rubi [A] (verified)

Time = 0.11 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.158, Rules used = {3647, 3705, 3556} \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {a^3 \log (\sin (c+d x))}{d}+b x \left (3 a^2-b^2\right )+\frac {b^2 (a+b \tan (c+d x))}{d}-\frac {3 a b^2 \log (\cos (c+d x))}{d} \]

[In]

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^3,x]

[Out]

b*(3*a^2 - b^2)*x - (3*a*b^2*Log[Cos[c + d*x]])/d + (a^3*Log[Sin[c + d*x]])/d + (b^2*(a + b*Tan[c + d*x]))/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3647

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Si
mp[b^2*(a + b*Tan[e + f*x])^(m - 2)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*(m + n - 1))), x] + Dist[1/(d*(m + n -
1)), Int[(a + b*Tan[e + f*x])^(m - 3)*(c + d*Tan[e + f*x])^n*Simp[a^3*d*(m + n - 1) - b^2*(b*c*(m - 2) + a*d*(
1 + n)) + b*d*(m + n - 1)*(3*a^2 - b^2)*Tan[e + f*x] - b^2*(b*c*(m - 2) - a*d*(3*m + 2*n - 4))*Tan[e + f*x]^2,
 x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]
&& IntegerQ[2*m] && GtQ[m, 2] && (GeQ[n, -1] || IntegerQ[m]) &&  !(IGtQ[n, 2] && ( !IntegerQ[m] || (EqQ[c, 0]
&& NeQ[a, 0])))

Rule 3705

Int[((A_) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2)/tan[(e_.) + (f_.)*(x_)], x_Symbol
] :> Simp[B*x, x] + (Dist[A, Int[1/Tan[e + f*x], x], x] + Dist[C, Int[Tan[e + f*x], x], x]) /; FreeQ[{e, f, A,
 B, C}, x] && NeQ[A, C]

Rubi steps \begin{align*} \text {integral}& = \frac {b^2 (a+b \tan (c+d x))}{d}+\int \cot (c+d x) \left (a^3+b \left (3 a^2-b^2\right ) \tan (c+d x)+3 a b^2 \tan ^2(c+d x)\right ) \, dx \\ & = b \left (3 a^2-b^2\right ) x+\frac {b^2 (a+b \tan (c+d x))}{d}+a^3 \int \cot (c+d x) \, dx+\left (3 a b^2\right ) \int \tan (c+d x) \, dx \\ & = b \left (3 a^2-b^2\right ) x-\frac {3 a b^2 \log (\cos (c+d x))}{d}+\frac {a^3 \log (\sin (c+d x))}{d}+\frac {b^2 (a+b \tan (c+d x))}{d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.22 (sec) , antiderivative size = 79, normalized size of antiderivative = 1.27 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=-\frac {(a+i b)^3 \log (i-\tan (c+d x))-2 a^3 \log (\tan (c+d x))+(a-i b)^3 \log (i+\tan (c+d x))-2 b^2 (a+b \tan (c+d x))}{2 d} \]

[In]

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^3,x]

[Out]

-1/2*((a + I*b)^3*Log[I - Tan[c + d*x]] - 2*a^3*Log[Tan[c + d*x]] + (a - I*b)^3*Log[I + Tan[c + d*x]] - 2*b^2*
(a + b*Tan[c + d*x]))/d

Maple [A] (verified)

Time = 0.64 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.11

method result size
norman \(\left (3 a^{2} b -b^{3}\right ) x +\frac {b^{3} \tan \left (d x +c \right )}{d}+\frac {a^{3} \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {a \left (a^{2}-3 b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(69\)
parallelrisch \(\frac {6 a^{2} b d x -2 b^{3} d x +2 a^{3} \ln \left (\tan \left (d x +c \right )\right )-\ln \left (\sec ^{2}\left (d x +c \right )\right ) a^{3}+3 \ln \left (\sec ^{2}\left (d x +c \right )\right ) a \,b^{2}+2 b^{3} \tan \left (d x +c \right )}{2 d}\) \(74\)
derivativedivides \(-\frac {-\frac {b^{3}}{\cot \left (d x +c \right )}+3 a \,b^{2} \ln \left (\cot \left (d x +c \right )\right )+\frac {\left (a^{3}-3 a \,b^{2}\right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (3 a^{2} b -b^{3}\right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{d}\) \(82\)
default \(-\frac {-\frac {b^{3}}{\cot \left (d x +c \right )}+3 a \,b^{2} \ln \left (\cot \left (d x +c \right )\right )+\frac {\left (a^{3}-3 a \,b^{2}\right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (3 a^{2} b -b^{3}\right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )}{d}\) \(82\)
risch \(3 a^{2} b x -b^{3} x -i a^{3} x +3 i a \,b^{2} x +\frac {6 i a \,b^{2} c}{d}-\frac {2 i a^{3} c}{d}+\frac {2 i b^{3}}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}-\frac {3 a \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{2}}{d}+\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}\) \(113\)

[In]

int(cot(d*x+c)*(a+b*tan(d*x+c))^3,x,method=_RETURNVERBOSE)

[Out]

(3*a^2*b-b^3)*x+b^3/d*tan(d*x+c)+1/d*a^3*ln(tan(d*x+c))-1/2*a*(a^2-3*b^2)/d*ln(1+tan(d*x+c)^2)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.26 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {a^{3} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - 3 \, a b^{2} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 2 \, b^{3} \tan \left (d x + c\right ) + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} d x}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3,x, algorithm="fricas")

[Out]

1/2*(a^3*log(tan(d*x + c)^2/(tan(d*x + c)^2 + 1)) - 3*a*b^2*log(1/(tan(d*x + c)^2 + 1)) + 2*b^3*tan(d*x + c) +
 2*(3*a^2*b - b^3)*d*x)/d

Sympy [A] (verification not implemented)

Time = 0.29 (sec) , antiderivative size = 92, normalized size of antiderivative = 1.48 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\begin {cases} - \frac {a^{3} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {a^{3} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 3 a^{2} b x + \frac {3 a b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} - b^{3} x + \frac {b^{3} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{3} \cot {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))**3,x)

[Out]

Piecewise((-a**3*log(tan(c + d*x)**2 + 1)/(2*d) + a**3*log(tan(c + d*x))/d + 3*a**2*b*x + 3*a*b**2*log(tan(c +
 d*x)**2 + 1)/(2*d) - b**3*x + b**3*tan(c + d*x)/d, Ne(d, 0)), (x*(a + b*tan(c))**3*cot(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.39 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.15 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {2 \, a^{3} \log \left (\tan \left (d x + c\right )\right ) + 2 \, b^{3} \tan \left (d x + c\right ) + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} {\left (d x + c\right )} - {\left (a^{3} - 3 \, a b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3,x, algorithm="maxima")

[Out]

1/2*(2*a^3*log(tan(d*x + c)) + 2*b^3*tan(d*x + c) + 2*(3*a^2*b - b^3)*(d*x + c) - (a^3 - 3*a*b^2)*log(tan(d*x
+ c)^2 + 1))/d

Giac [A] (verification not implemented)

none

Time = 0.81 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.16 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {2 \, a^{3} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) + 2 \, b^{3} \tan \left (d x + c\right ) + 2 \, {\left (3 \, a^{2} b - b^{3}\right )} {\left (d x + c\right )} - {\left (a^{3} - 3 \, a b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \]

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^3,x, algorithm="giac")

[Out]

1/2*(2*a^3*log(abs(tan(d*x + c))) + 2*b^3*tan(d*x + c) + 2*(3*a^2*b - b^3)*(d*x + c) - (a^3 - 3*a*b^2)*log(tan
(d*x + c)^2 + 1))/d

Mupad [B] (verification not implemented)

Time = 4.62 (sec) , antiderivative size = 75, normalized size of antiderivative = 1.21 \[ \int \cot (c+d x) (a+b \tan (c+d x))^3 \, dx=\frac {b^3\,\mathrm {tan}\left (c+d\,x\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,{\left (a+b\,1{}\mathrm {i}\right )}^3}{2\,d}+\frac {a^3\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^3\,1{}\mathrm {i}}{2\,d} \]

[In]

int(cot(c + d*x)*(a + b*tan(c + d*x))^3,x)

[Out]

(b^3*tan(c + d*x))/d - (log(tan(c + d*x) + 1i)*(a*1i + b)^3*1i)/(2*d) - (log(tan(c + d*x) - 1i)*(a + b*1i)^3)/
(2*d) + (a^3*log(tan(c + d*x)))/d